package com.lxy.dubbo.consumer;

import com.lxy.dubbo.api.service.HelloService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created by xiaoyi on 2016/7/19.
 */
@SpringBootApplication
@ImportResource({"classpath:spring-dubbo.xml"})
public class App {
    private static final Logger logger = LoggerFactory.getLogger(App.class);





    public static void main(String[] args){
     //   ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(new String[]{"classpath:spring-dubbo.xml"});

        ApplicationContext ctx = SpringApplication.run(App.class, args);

        logger.info("项目启动!");

     //   new Client().getHelloService().sayHello("lxy");
      //  HelloService helloService = (HelloService) ctx.getBean("helloService");

        Client client = (Client)ctx.getBean("client");
       System.out.println( client.getHelloService().sayHello("lxy"));
       // System.out.println(helloService.sayHello("lxy"));
    }
}
